package com.qf2210.group.three.server.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import com.qf2210.group.three.pojo.TbUser;
import com.qf2210.group.three.server.service.TbUserService;
import com.qf2210.group.three.server.mapper.TbUserMapper;
import org.springframework.stereotype.Service;

/**
* @author HASEE
* @description 针对表【tb_user】的数据库操作Service实现
* @createDate 2022-12-01 10:45:21
*/
@Service
public class TbUserServiceImpl extends ServiceImpl<TbUserMapper, TbUser>
    implements TbUserService{

    @Override
    public TbUser login(TbUser tbUser) {
        QueryWrapper<TbUser> queryWrapper =new QueryWrapper<>();
        queryWrapper.eq("user_name",tbUser.getUserName());
        TbUser realTbUser = this.baseMapper.selectOne(queryWrapper);
        if (realTbUser!=null){
            if (realTbUser.getUserPassword().equals(tbUser.getUserPassword())){
                return realTbUser;
            }
        }
        return null;
    }
}




